const path = require('path')

module.exports = {
  publicPath: './',
  runtimeCompiler: true,
  css: {
    loaderOptions: {
      // 给 less-loader 传递选项
      less: {
        javascriptEnabled: true
      }
    }
  },
  configureWebpack: {
    resolve: {
      alias: {
        '@lib': path.resolve(__dirname, './lib'),
        '@util': path.resolve(__dirname, './lib/_util'),
        '@style': path.resolve(__dirname, './lib/styles')
      }
    },
    module: {
      rules: [
        {
          test: /\.md$/,
          use: [
            {
              loader: 'vue-loader',
              options: {
                compilerOptions: {
                  preserveWhitespace: false
                }
              }
            },
            {
              loader: path.resolve(__dirname, './src/loader/index.js')
            }
          ]
        }
      ]
    }
  },
  chainWebpack:(config) => {
    //忽略的打包文件
    config.externals({
      'vue': 'Vue',
      'vue-router': 'VueRouter',
      'element-ui': 'ELEMENT'
    })
  }
}
